package com.beiding.sqlbuilder.impl;

import com.beiding.sqlbuilder.BuilderContext;
import com.beiding.sqlbuilder.Parameter;
import com.beiding.sqlbuilder.ParameterHolder;
import com.beiding.sqlbuilder.SingleParameter;

public class SimpleSingleParameter implements SingleParameter {

    private ParameterHolder parameterHolder;

    private Parameter parameter;


    public SimpleSingleParameter(Parameter parameter) {
        this.parameter = parameter;
    }

    @Override
    public ParameterHolder getParameter() {
        return parameterHolder;
    }

    @Override
    public void build(BuilderContext builderContext) {
        if (this.parameterHolder == null) {
            this.parameterHolder = ConditionUtils.buildParameterHolder(parameter, builderContext.getParameterHandlers());
        }
    }

}
